﻿

using Microsoft.EntityFrameworkCore;
using System.Threading;
using System.Threading.Tasks;
using wt.wine.Application.Common.Models;
using wt.wine.Application.ManageConfigtable;
using wt.wine.Domain.Entities;

namespace wt.wine.Application.Common.Interfaces
{
    public interface IConfigtableRepository
    {
        /// <summary>
        /// 获取列表数据
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="cancellationtoken"></param>
        /// <returns></returns>
        Task<PaginatedList<GetconfigtableDTO>> GetconfigtableList(int userid, int pageIndex, int pageSize, CancellationToken cancellationtoken);

        /// <summary>
        /// 修改前的查询
        /// </summary>
        /// <param name="id"></param>
        /// <param name="userid"></param>
        /// <param name="cancellationtoken"></param>
        /// <returns></returns>
        Task<configtable> GetConfigTableById(int id, int userid, CancellationToken cancellationtoken);

        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="model"></param>
        /// <param name="cancellationtoken"></param>
        /// <returns></returns>
        Task AddConfigTable(configtable model, CancellationToken cancellationtoken);
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="model"></param>
        /// <param name="cancellationtoken"></param>
        /// <returns></returns>
        Task EditConfigTable(configtable model, CancellationToken cancellationtoken);

        /// <summary>
        /// 判断当前类型的配置是否存在
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="type"></param>
        /// <param name="cancellationtoken"></param>
        /// <returns></returns>
        Task<int> GetTypeCountByUserId(int userid, int type, CancellationToken cancellationtoken);
    }
}
